package cn.wgx.module.mind.service;

import cn.wgx.common.entity.mind.MindLink;
import cn.wgx.module.mind.entity.mapper.LinkMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;

@Service
public class LinkService extends BaseMindService<LinkMapper, MindLink> {


    public boolean removeByBeatId(Serializable beat_id){
        QueryWrapper<MindLink> queryWrapper = new QueryWrapper();
        queryWrapper.eq("start_id", beat_id);
        queryWrapper.or().eq("end_id", beat_id);
        return remove(queryWrapper);
    }

    public boolean removeByBeatId(Collection<? extends Serializable> mindBeats){
        QueryWrapper<MindLink> queryWrapper = new QueryWrapper();
        queryWrapper.in("start_id", mindBeats);
        queryWrapper.or().in("end_id", mindBeats);
        return remove(queryWrapper);
    }

}
